
from create_app import create_app
from config.obj_config import DevConfig


app = create_app(DevConfig)



from flask import g
from flask_restful import reqparse
from utils.Jwt_Token import JwtCode


@app.before_request
def gz():
    resp = reqparse.RequestParser()
    resp.add_argument('token',location = 'headers')
    args = resp.parse_args()

    if not args['token']:
        user_id = 0
    else:
        dar = JwtCode().yan_jwt(args['token'])
        if not dar:
            user_id = 0
        else:
            user_id = dar['id']

    g.user_id = user_id



